<TITLE>prob019: magic squares and sequences</TITLE>
<HR><!------------------------------------------------------------------------>
<CENTER>
<H1>prob019: magic squares and sequences</H1>

<TABLE>
<TR> <TD> proposed by
     <TD ALIGN=LEFT> <A HREF="http://dream.dai.ed.ac.uk/group/tw">
          <B>Toby Walsh</B></A> 
          <ADDRESS><a href="mailto:tw@cs.strath.ac.uk">
          tw@cs.strath.ac.uk</a></ADDRESS>
</TABLE>
</CENTER>
<HR><!------------------------------------------------------------------------>
<H3> Specification </H3>

<TT>
An order n magic square is a n by n matrix containing the numbers
1 to n^2, with each row, column and main diagonal equal the same sum.
As well as finding magic squares, we are interested in the number
of a given size that exist.
<P>
There are several interesting 
variations. For example, we may insist on certain
values in certain squares (like in quasigroup completion) 
and ask if the magic square can be completed. 
In a heterosquare, each row, column and diagonal sums to
a different value. 
In an anti-magic square,
the row, column and diagonal sums form a sequence of
consecutive integers.
<P>
A magic sequence of
length n is a sequence of integers x0 . . xn-1 
between 0 and n-1, such that 
for all i in 0 to n-1, 
the number i occurs exactly xi times in the sequence. 
For instance, 6,2,1,0,0,0,1,0,0,0 is a magic sequence
since 0 occurs 6 times in it,
1 occurs twice, ...

<P>

</TT>


<HR><!------------------------------------------------------------------------>

<UL>

 <A HREF="../../index.html"> Back</A> to CSPLib home page.


